﻿using System;
namespace Producers.Etoimik.Xtee.Riik.Ee.Producer.Etoimik {
    
    
    [global::Xtee.Core.Attributes.XmlTypeAttribute(Name="ETHoiatus", Namespace="http://producers.etoimik.xtee.riik.ee/producer/etoimik", Target=typeof(ETHoiatus))]
    public class ETHoiatusSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
        
        protected IETHoiatus clazz;
        
        public ETHoiatusSerializer(IETHoiatus clazz) {
            this.clazz = clazz;
        }
        
        public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
            base.WriteXml(Writer);
            if (clazz.VeaGrupp!=null) {
                Writer.WriteStartElement("VeaGrupp");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.VeaGrupp))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.VeaKood!=null) {
                Writer.WriteStartElement("VeaKood");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.VeaKood))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.VeaSonum!=null) {
                Writer.WriteStartElement("VeaSonum");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.VeaSonum))).ToString());
                Writer.WriteEndElement();
            }
        }
        
        public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
            base.ReadXml(Reader);
            if (Reader.LocalName=="VeaGrupp") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.VeaGrupp = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("VeaGrupp")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="VeaKood") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.VeaKood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("VeaKood")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            if (Reader.LocalName=="VeaSonum") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.VeaSonum = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("VeaSonum")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
        }
    }
}
